﻿Public Class Form1

    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

    Dim clipboard1 As String = "clipboard1" 'strings to store clipboard information in
    Dim clipboard2 As String = "clipboard2"
    Dim clipboard3 As String = "clipboard3"
    Dim clipboard4 As String = "clipboard4"
    Dim clipboard5 As String = "clipboard5"
    Dim clipboard6 As String = "clipboard6"
    Dim clipboard7 As String = "clipboard7"
    Dim clipboard8 As String = "clipboard8"
    Dim clipboard9 As String = "clipboard9"
    Dim clipboard10 As String = "clipboard10"
    Dim clipboard11 As String = "clipboard11"
    Dim clipboard12 As String = "clipboard12"

    Dim vclip1 As Boolean = True 'Booleans to show whether a clipboard is active or not
    Dim vclip2 As Boolean = False 'Default clipboard is clipboard 1
    Dim vclip3 As Boolean = False
    Dim vclip4 As Boolean = False
    Dim vclip5 As Boolean = False
    Dim vclip6 As Boolean = False
    Dim vclip7 As Boolean = False
    Dim vclip8 As Boolean = False
    Dim vclip9 As Boolean = False
    Dim vclip10 As Boolean = False
    Dim vclip11 As Boolean = False
    Dim vclip12 As Boolean = False


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Visible = False 'Hides all textboxes when the program launches
        TextBox2.Visible = False
        TextBox3.Visible = False
        TextBox4.Visible = False
        TextBox5.Visible = False
        TextBox6.Visible = False
        TextBox7.Visible = False
        TextBox8.Visible = False
        TextBox9.Visible = False
        TextBox10.Visible = False
        TextBox11.Visible = False
        TextBox12.Visible = False

        With Timer1 'Enables and sets the interval for the global hotkey timers
            .Enabled = True
            .Interval = 1
        End With

        With Timer2
            .Enabled = True
            .Interval = 1
        End With

        With Timer3
            .Enabled = True
            .Interval = 1
        End With

        With Timer4
            .Enabled = True
            .Interval = 1
        End With

        With Timer5
            .Enabled = True
            .Interval = 1
        End With

        With Timer6
            .Enabled = True
            .Interval = 1
        End With

        With Timer7
            .Enabled = True
            .Interval = 1
        End With

        With Timer8
            .Enabled = True
            .Interval = 1
        End With

        With Timer9
            .Enabled = True
            .Interval = 1
        End With

        With Timer10
            .Enabled = True
            .Interval = 1
        End With

        With Timer11
            .Enabled = True
            .Interval = 1
        End With

        With Timer13
            .Enabled = True
            .Interval = 1
        End With

        With Timer14
            .Enabled = True
            .Interval = 1
        End With

        Clipboard.SetDataObject(clipboard1, True)

    End Sub

    Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
        TextBox1.Visible = True 'Makes textbox unvisible (same to all other 12)
    End Sub

    Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
        TextBox2.Visible = True
    End Sub

    Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
        TextBox3.Visible = True
    End Sub

    Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
        TextBox4.Visible = True
    End Sub

    Private Sub ToolStripMenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem6.Click
        TextBox5.Visible = True
    End Sub

    Private Sub ToolStripMenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem7.Click
        TextBox6.Visible = True
    End Sub

    Private Sub ToolStripMenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem8.Click
        TextBox7.Visible = True
    End Sub

    Private Sub ToolStripMenuItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem9.Click
        TextBox8.Visible = True
    End Sub

    Private Sub ToolStripMenuItem10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem10.Click
        TextBox9.Visible = True
    End Sub

    Private Sub ToolStripMenuItem11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem11.Click
        TextBox10.Visible = True
    End Sub

    Private Sub ToolStripMenuItem12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem12.Click
        TextBox11.Visible = True
    End Sub

    Private Sub ToolStripMenuItem13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem13.Click
        TextBox12.Visible = True
    End Sub

    Private Sub ShowAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowAllToolStripMenuItem.Click
        TextBox1.Visible = True 'Makes all textboxes visible
        TextBox2.Visible = True
        TextBox3.Visible = True
        TextBox4.Visible = True
        TextBox5.Visible = True
        TextBox6.Visible = True
        TextBox7.Visible = True
        TextBox8.Visible = True
        TextBox9.Visible = True
        TextBox10.Visible = True
        TextBox11.Visible = True
        TextBox12.Visible = True

    End Sub

    Private Sub QuitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitToolStripMenuItem.Click
        Me.Close() 'Closes the application
    End Sub

    Private Sub ToolStripMenuItem14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem14.Click
        TextBox1.Visible = False 'Makes textbox visible

    End Sub

    Private Sub ToolStripMenuItem15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem15.Click
        TextBox2.Visible = False
    End Sub

    Private Sub ToolStripMenuItem16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem16.Click
        TextBox3.Visible = False
    End Sub

    Private Sub ToolStripMenuItem17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem17.Click
        TextBox4.Visible = False
    End Sub

    Private Sub ToolStripMenuItem18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem18.Click
        TextBox5.Visible = False
    End Sub

    Private Sub ToolStripMenuItem19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem19.Click
        TextBox6.Visible = False
    End Sub

    Private Sub ToolStripMenuItem20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem20.Click
        TextBox7.Visible = False
    End Sub

    Private Sub ToolStripMenuItem21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem21.Click
        TextBox8.Visible = False
    End Sub

    Private Sub ToolStripMenuItem22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem22.Click
        TextBox9.Visible = False
    End Sub

    Private Sub ToolStripMenuItem23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem23.Click
        TextBox10.Visible = False
    End Sub

    Private Sub ToolStripMenuItem24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem24.Click
        TextBox11.Visible = False
    End Sub

    Private Sub ToolStripMenuItem25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem25.Click
        TextBox12.Visible = False
    End Sub

    Private Sub HideAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HideAllToolStripMenuItem.Click
        TextBox1.Visible = False ' Makes all textboxes visible
        TextBox2.Visible = False
        TextBox3.Visible = False
        TextBox4.Visible = False
        TextBox5.Visible = False
        TextBox6.Visible = False
        TextBox7.Visible = False
        TextBox8.Visible = False
        TextBox9.Visible = False
        TextBox10.Visible = False
        TextBox11.Visible = False
        TextBox12.Visible = False

    End Sub

    Private Sub HideToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HideToolStripMenuItem.Click
        Me.Hide() 'This hides the window
        NotifyIcon1.Visible = True 'This makes the icon visible in the system tray
    End Sub

    Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
        Me.Show() 'This shows the program when the tray icon is double clicked
        NotifyIcon1.Visible = False 'This removes the icon from the tray, this is optional as you may want to to stay in the tray
    End Sub

    Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
        MsgBox("Info") 'Opens a messagebox
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 'Copy hotkey

        Dim ctrlkey As Boolean
        Dim c As Boolean

        ctrlkey = GetAsyncKeyState(Keys.ControlKey)
        c = GetAsyncKeyState(Keys.C)

        If ctrlkey And c = True Then
            Select Case vclip1
                Case True
                    'code for when control + c is pushed
                    TextBox1.Show() 'Show textbox1
                    clipboard1 = GetClipboardText() 'Goto GetClipboardText and save it as a string
                    TextBox1.Text = clipboard1 'Cast string into TextBox1
                Case False
            End Select

            Select Case vclip2
                Case True
                    'code for when control + c is pushed
                    TextBox2.Show() 'Show textbox2 to show it has a value
                    clipboard2 = GetClipboardText() 'Goto GetClipboardText and save it as a string                            TextBox2.Text = clipboard2 'Cast string into TextBox2
                Case False
            End Select

            Select Case vclip3
                Case True
                    TextBox3.Show()
                    clipboard3 = GetClipboardText()
                Case False
            End Select

            Select Case vclip4
                Case True
                    TextBox4.Show()
                    clipboard4 = GetClipboardText()
                Case False
            End Select

            Select Case vclip5
                Case True
                    TextBox5.Show()
                    clipboard5 = GetClipboardText()
                Case False
            End Select

            Select Case vclip6
                Case True
                    TextBox6.Show()
                    clipboard6 = GetClipboardText()
                Case False
            End Select

            Select Case vclip7
                Case True
                    TextBox7.Show()
                    clipboard7 = GetClipboardText()
                Case False
            End Select

            Select Case vclip8
                Case True
                    TextBox8.Show()
                    clipboard8 = GetClipboardText()
                Case False
            End Select

            Select Case vclip9
                Case True
                    TextBox9.Show()
                    clipboard9 = GetClipboardText()
                Case False
            End Select

            Select Case vclip10
                Case True
                    TextBox10.Show()
                    clipboard10 = GetClipboardText()
                Case False
            End Select

            Select Case vclip11
                Case True
                    TextBox11.Show()
                    clipboard11 = GetClipboardText()
                Case False
            End Select

            Select Case vclip12
                Case True
                    TextBox12.Show()
                    clipboard12 = GetClipboardText()
                Case False
            End Select

        End If
    End Sub

    Public Function GetClipboardText() As String 'Read clipboard and return clipboard as string
        Dim objClipboard As IDataObject = Clipboard.GetDataObject()
        With objClipboard
            If .GetDataPresent(DataFormats.Text) Then Return _
               .GetData(DataFormats.Text)
        End With
    End Function

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 'Paste hotkey

        Dim ctrlkey As Boolean
        Dim v As Boolean

        ctrlkey = GetAsyncKeyState(Keys.ControlKey)
        v = GetAsyncKeyState(Keys.V)

        If ctrlkey And v = True Then

            Select Case vclip1
                Case True 'If clipboard 1 is active, execute below code
                    TextBox1.Show() 'Show textbox1
                    Clipboard.SetDataObject(clipboard1, True) 'Put the data stored in clipboard1 on the clipboard
                    TextBox1.Text = clipboard1 'Cast string into TextBox1
                Case False 'If clipboard 1 is not active, do nothing
            End Select

            Select Case vclip2 'If clipboard 2 is active, execute below code
                Case True
                    TextBox2.Show() 'Show textbox2
                    Clipboard.SetDataObject(clipboard2, True) 'Put the data stored in clipboard1 on the clipboard
                    TextBox2.Text = clipboard2 'Cast string into TextBox2
                Case False 'If clipboard 2 is not active, do nothing
            End Select

            Select Case vclip3
                Case True
                    TextBox3.Show()
                    Clipboard.SetDataObject(clipboard3, True)
                    TextBox3.Text = clipboard3
                Case False
            End Select

            Select Case vclip4
                Case True
                    TextBox4.Show()
                    Clipboard.SetDataObject(clipboard4, True)
                    TextBox4.Text = clipboard4
                Case False
            End Select

            Select Case vclip5
                Case True
                    TextBox5.Show()
                    Clipboard.SetDataObject(clipboard5, True)
                    TextBox5.Text = clipboard5
                Case False
            End Select

            Select Case vclip6
                Case True
                    TextBox6.Show()
                    Clipboard.SetDataObject(clipboard6, True)
                    TextBox6.Text = clipboard6
                Case False
            End Select

            Select Case vclip7
                Case True
                    TextBox7.Show()
                    Clipboard.SetDataObject(clipboard7, True)
                    TextBox7.Text = clipboard7
                Case False
            End Select

            Select Case vclip8
                Case True
                    TextBox8.Show()
                    Clipboard.SetDataObject(clipboard8, True)
                    TextBox8.Text = clipboard8
                Case False
            End Select

            Select Case vclip9
                Case True
                    TextBox9.Show()
                    Clipboard.SetDataObject(clipboard9, True)
                    TextBox9.Text = clipboard9
                Case False
            End Select

            Select Case vclip10
                Case True
                    TextBox10.Show()
                    Clipboard.SetDataObject(clipboard10, True)
                    TextBox10.Text = clipboard10
                Case False
            End Select

            Select Case vclip11
                Case True
                    TextBox11.Show()
                    Clipboard.SetDataObject(clipboard11, True)
                    TextBox11.Text = clipboard11
                Case False
            End Select

            Select Case vclip12
                Case True
                    TextBox12.Show()
                    Clipboard.SetDataObject(clipboard12, True)
                    TextBox12.Text = clipboard12
                Case False
            End Select


        End If
    End Sub

    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Dim altkey As Boolean
        Dim f1 As Boolean

        altkey = GetAsyncKeyState(Keys.Alt)
        f1 = GetAsyncKeyState(Keys.F1)

        If altkey And f1 = True Then
            vclip1 = True
            vclip2 = False
            vclip3 = False
            vclip4 = False
            vclip5 = False
            vclip6 = False
            vclip7 = False
            vclip8 = False
            vclip9 = False
            vclip10 = False
            vclip11 = False
            vclip12 = False
        End If
    End Sub

    Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Dim altkey As Boolean
        Dim f2 As Boolean

        altkey = GetAsyncKeyState(Keys.Alt)
        f2 = GetAsyncKeyState(Keys.F2)

        If altkey And f2 = True Then
            vclip1 = False
            vclip2 = True
            vclip3 = False
            vclip4 = False
            vclip5 = False
            vclip6 = False
            vclip7 = False
            vclip8 = False
            vclip9 = False
            vclip10 = False
            vclip11 = False
            vclip12 = False
        End If
    End Sub

End Class
